1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module shumate.Coordinate; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import shumate.LocationIF; 30 private import shumate.LocationT; 31 private import shumate.c.functions; 32 public import shumate.c.types; 33 34 35 /** 36 * A simple object implementing [iface@Location]. 37 */ 38 public class Coordinate : ObjectG, LocationIF 39 { 40 /** the main Gtk struct */ 41 protected ShumateCoordinate* shumateCoordinate; 42 43 /** Get the main Gtk struct */ 44 public ShumateCoordinate* getCoordinateStruct(bool transferOwnership = false) 45 { 46 if (transferOwnership) 47 ownedRef = false; 48 return shumateCoordinate; 49 } 50 51 /** the main Gtk struct as a void* */ 52 protected override void* getStruct() 53 { 54 return cast(void*)shumateCoordinate; 55 } 56 57 /** 58 * Sets our main struct and passes it to the parent class. 59 */ 60 public this (ShumateCoordinate* shumateCoordinate, bool ownedRef = false) 61 { 62 this.shumateCoordinate = shumateCoordinate; 63 super(cast(GObject*)shumateCoordinate, ownedRef); 64 } 65 66 // add the Location capabilities 67 mixin LocationT!(ShumateCoordinate); 68 69 70 /** */ 71 public static GType getType() 72 { 73 return shumate_coordinate_get_type(); 74 } 75 76 /** 77 * Creates a new instance of #ShumateCoordinate. 78 * 79 * Returns: the created instance. 80 * 81 * Throws: ConstructionException GTK+ fails to create the object. 82 */ 83 public this() 84 { 85 auto __p = shumate_coordinate_new(); 86 87 if(__p is null) 88 { 89 throw new ConstructionException("null returned by new"); 90 } 91 92 this(cast(ShumateCoordinate*) __p); 93 } 94 95 /** 96 * Creates a new instance of #ShumateCoordinate initialized with the given 97 * coordinates. 98 * 99 * Params: 100 * latitude = the latitude coordinate 101 * longitude = the longitude coordinate 102 * 103 * Returns: the created instance. 104 * 105 * Throws: ConstructionException GTK+ fails to create the object. 106 */ 107 public this(double latitude, double longitude) 108 { 109 auto __p = shumate_coordinate_new_full(latitude, longitude); 110 111 if(__p is null) 112 { 113 throw new ConstructionException("null returned by new_full"); 114 } 115 116 this(cast(ShumateCoordinate*) __p); 117 } 118 }